#ifndef PAGESPEEDTEST_H
#define PAGESPEEDTEST_H

#include <QWidget>
#include <QLineEdit>
#include <QKeyEvent>
#include <QEvent>
#include <QLabel>
#include <QTimer>
#include <QRegExp>
#include <QRegExpValidator>
#include "slimnumkeyboard.h"
#include "global_def.h"

namespace Ui {
class PageSpeedTest;
}

class PageSpeedTest : public QWidget
{
    Q_OBJECT

public:
    explicit PageSpeedTest(QWidget *parent = nullptr);
    ~PageSpeedTest();
    enum
    {
        SPeedTest_PRO,
        SpeedTest_BRK,
        SpeedTest_InitSpeed=0,
        SpeedTest_Distance,
        SpeedTest_Duration,
        SpeedTest_EndSpeed,
        SpeedTest_Acceleration
    };
    void setPageActive(bool xActive);
    void setTestStartSpeed(uint8_t index, float speed);
    void setTestDistance(uint8_t index,float distance);
    void setTestEndSpeed(uint8_t index,float speed);
    void setTestDuration(uint8_t index,float time);
    void setAcceleration(uint8_t index,float speed);
    uint8_t getTestSpeed();
protected:
     bool eventFilter(QObject *obj, QEvent *event);
signals:
    void returnToMaintMenu();
    void signal_speed_test_init(bool);
    void signal_speed_test_start(bool);
private slots:
    void on_Btn_Return_clicked();
    void input_slot(int);
    void backspace_slot();
    void cancel_slot();
    void on_Btn_Init_clicked();
    void on_Btn_Start_clicked(bool checked);

private:
    SlimNumKeyBoard *m_pKeyBoard;
private:
    Ui::PageSpeedTest *ui;
    QList<QLabel*> m_lTestList;
};

#endif // PAGESPEEDTEST_H
